<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="DaosImpl.RoomDaoImpl"  import="Beans.RoomType" import="Beans.Room"%>
<html>
	<%
		String path = request.getContextPath();
		String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
	 %>
  <head>
    <meta charset="UTF-8">
    <link href=<%=basePath+"/stylesheets/registerInHome.css" %> type="text/css" rel="stylesheet" charset="utf-8">
    <style>
        html,body{
            height: 100%;
            margin:0;
            padding: 0;
        }
    </style>
    <title>入住登记</title>
  </head>
  
  <body>
  <%
  		String msg = (String)session.getAttribute("msg");
  		session.removeAttribute("msg");
  		if(msg!=null&&msg!=""){
  			%>
  			<script type="text/javascript">
  				var msg = '<%=msg%>'
  				alert(msg);
  			</script>
  			<%
  		}
   %>
<div id="themeText">酒店入住登记</div>
<div id="showRoomFrame">
    <div id="infoText">入住信息</div>
    <form action="/HotelSystem/Servlets/SubmitInfoServlet" method="post">
        <div id="typeDiv">
            <label>房间类型：</label>
            <%
            	request.setCharacterEncoding("UTF-8");
            	String type = request.getParameter("type");
            	if(type==null || type==""){
            		type="单人间";
            	}
             %>
            <select name="roomtype" style="padding: 3px;margin-left: 8px;margin-top: 1px;border-radius: 3px" id="selectType" onchange="change()">
                <option>单人间</option>
                <option>标准间</option>
                <option>高级标间</option>
                <option>三人间</option>
                <option>豪华套间</option>
            </select>
            <script type="text/javascript">
            	var select = document.getElementById("selectType");
            	var type = '<%=type%>';
            	type = decodeURI(decodeURI(type));
            	for(i = 0;i<select.options.length;i++){
            		if(select.options[i].text===type){
            			select.options[i].selected=true;
            		}
            	}
            </script>
        </div>
        
        <div style="margin-top: 15px;">
            <div style="display: inline-block; margin-left: 40px;margin-top: 5px">
                <label>姓名：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;" name="name1">
            </div>
            <div style="display: inline-block;margin-left: 40px;">
                <label>性别：</label>
                <span style="margin-left: 10px">男</span>
                <input type="radio" name="sex1" value="男" class="radioFormat" style="margin-left: 15px">
                <span style="margin-left: 10px">女</span>
                <input type="radio" name="sex1" value="女" class="radioFormat" style="margin-left: 15px">
            </div>
            <div style="display: inline-block;margin-left: 40px;">
                <label>年龄：</label>
                <input type="text" name="ageNum1" class="inputInfo" style="padding-right: 0;width: 40px;">
            </div>
            <div style="display: inline-block;margin-left: 40px;">
                <label>电话号码：</label>
                <input type="text" name="phoneNum1" class="inputInfo" style="padding-right: 0;width: 200px;">
            </div>
            <div style="display: inline-block;margin-left: 40px;">
                <label>身份证：</label>
                <input type="text" name="idNum1" class="inputInfo">
            </div>
        </div>
        <div style="margin-top: 15px;height: 50px;">
            <div style="display: inline-block; margin-left: 40px;margin-top: 5px">
                <label>房号：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;" name="roomid" id="roomid">
            </div>
            <div style="display: inline-block; margin-left: 40px;margin-top: 5px">
                <label>入住时间：</label>
                <input type="date" class="inputInfo" style="padding-right: 0;width: 150px;" name="indate" id="indate">
            </div>
            <div style="display: inline-block; margin-left: 40px;margin-top: 5px">
                <label>离开时间：</label>
                <input type="date" class="inputInfo" style="padding-right: 0;width: 150px;" name="outdate" id="outdate">
            </div>
            <div style="display: inline-block; margin-left: 40px;margin-top: 5px">
                <label>定金：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;color:red;font-size:16px" name="earnest" readonly=”readonly” id="earnest" value="">
            </div>
        </div>
        <div style="color: red;margin-left: 20px;margin-top: 15px">
            <span>*<span style="color:  rgba(0, 0, 0, 0.65);">选填信息：（多名旅客时需填请添加）</span></span>
            <img src=<%=basePath+"/images/add.jpg"%> class="addSubImg" id="add">
            <img src=<%=basePath+"/images/sub.jpg" %> class="addSubImg" style="width: 30px;" id="sub">
        </div>
        <div style="margin-top: 15px;display: none" id="div2">
            <div style="display: inline-block; margin-left: 60px;margin-top: 5px">
                <label>姓名：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;" name="name2">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>性别：</label>
                <span style="margin-left: 10px">男</span>
                <input type="radio" name="sex2" value="男" class="radioFormat" style="margin-left: 15px">
                <span style="margin-left: 10px">女</span>
                <input type="radio" name="sex2" value="女" class="radioFormat" style="margin-left: 15px">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>年龄：</label>
                <input type="text" name="ageNum2" class="inputInfo" style="padding-right: 0;width: 40px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>电话号码：</label>
                <input type="text" name="phoneNum2" class="inputInfo" style="padding-right: 0;width: 200px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>身份证：</label>
                <input type="text" name="idNum2" class="inputInfo">
            </div>
        </div>
        <div style="margin-top: 15px;display: none" id="div3">
            <div style="display: inline-block; margin-left: 60px;margin-top: 5px">
                <label>姓名：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;" name="name3">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>性别：</label>
                <span style="margin-left: 10px">男</span>
                <input type="radio" name="sex3" value="男" class="radioFormat" style="margin-left: 15px">
                <span style="margin-left: 10px">女</span>
                <input type="radio" name="sex3" value="女" class="radioFormat" style="margin-left: 15px">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>年龄：</label>
                <input type="text" name="ageNum3" class="inputInfo" style="padding-right: 0;width: 40px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>电话号码：</label>
                <input type="text" name="phoneNum3" class="inputInfo" style="padding-right: 0;width: 200px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>身份证：</label>
                <input type="text" name="idNum3" class="inputInfo">
            </div>
        </div>
        <div style="margin-top: 15px;display: none" id="div4">
            <div style="display: inline-block; margin-left: 60px;margin-top: 5px">
                <label>姓名：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;" name="name4">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>性别：</label>
                <span style="margin-left: 10px">男</span>
                <input type="radio" name="sex4" value="男" class="radioFormat" style="margin-left: 15px">
                <span style="margin-left: 10px">女</span>
                <input type="radio" name="sex4" value="女" class="radioFormat" style="margin-left: 15px">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>年龄：</label>
                <input type="text" name="ageNum4" class="inputInfo" style="padding-right: 0;width: 40px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>电话号码：</label>
                <input type="text" name="phoneNum4" class="inputInfo" style="padding-right: 0;width: 200px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>身份证：</label>
                <input type="text" name="idNum4" class="inputInfo">
            </div>
        </div>
        <div style="margin-top: 15px;display: none" id="div5">
            <div style="display: inline-block; margin-left: 60px;margin-top: 5px">
                <label>姓名：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;" name="name5">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>性别：</label>
                <span style="margin-left: 10px">男</span>
                <input type="radio" name="sex5" value="男" class="radioFormat" style="margin-left: 15px">
                <span style="margin-left: 10px">女</span>
                <input type="radio" name="sex5" value="女" class="radioFormat" style="margin-left: 15px">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>年龄：</label>
                <input type="text" name="ageNum5" class="inputInfo" style="padding-right: 0;width: 40px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>电话号码：</label>
                <input type="text" name="phoneNum5" class="inputInfo" style="padding-right: 0;width: 200px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>身份证：</label>
                <input type="text" name="idNum5" class="inputInfo">
            </div>
        </div>
        <div style="margin-top: 15px;display: none" id="div6">
            <div style="display: inline-block; margin-left: 60px;margin-top: 5px">
                <label>姓名：</label>
                <input type="text" class="inputInfo" style="padding-right: 0;width: 100px;" name="name6">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>性别：</label>
                <span style="margin-left: 10px">男</span>
                <input type="radio" name="sex6" value="男" class="radioFormat" style="margin-left: 15px">
                <span style="margin-left: 10px">女</span>
                <input type="radio" name="sex6" value="女" class="radioFormat" style="margin-left: 15px">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>年龄：</label>
                <input type="text" name="ageNum6" class="inputInfo" style="padding-right: 0;width: 40px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>电话号码：</label>
                <input type="text" name="phoneNum6" class="inputInfo" style="padding-right: 0;width: 200px;">
            </div>
            <div style="display: inline-block;margin-left: 50px;">
                <label>身份证：</label>
                <input type="text" name="idNum6" class="inputInfo">
            </div>
        </div>
        <input type="hidden" id="getN" name="peopleN" value="1">
        <div style="text-align: center">
            <input type="submit" value="提交信息" style="padding:10px 50px;border: 1px solid deepskyblue; border-radius:5px;background-color: deepskyblue;margin-top: 50px">
        </div>
    </form>
   	<div style="border-top: 1px solid #dcdcdc;margin-top: 20px;margin-bottom:20px">
   		<div style="color: rgba(0, 0, 0, 0.65);font-size: 16px;border-bottom: 1px solid #dcdcdc;">
   			<p style="margin-left:20px">房间剩余信息</p>
   		</div>
   		<%
   			type = java.net.URLDecoder.decode(type,"UTF-8");
   			%>
   			<p style="font-size:14px;font-weight:bolder;margin-left:20px"><%=type%></p>
   			<%
   			if(type!=null&&!type.equals("")){
   				RoomDaoImpl roomDao = new RoomDaoImpl();
	   			ArrayList<Room> roomList = new ArrayList<Room>();
	   			ArrayList<RoomType> roomTypeList = new ArrayList<RoomType>();
	   			roomList = roomDao.queryAllRooms();
	   			roomTypeList = roomDao.queryAllRoomTypes();
	   			for(int i = 0;i<roomList.size();i++){
	   				String status = roomList.get(i).getRoomStatus();	//房间状态
	   				if(status.trim().equals("1")){
	   					for(int j = 0;j<roomTypeList.size();j++){
	   						if(roomList.get(i).getRoomTypeID()==roomTypeList.get(j).getRoomTypeID()&&roomTypeList.get(j).getRoomTypeName().equals(type)){
	   							%>
	   							<div class="roomRec">
	            					<div><%=roomList.get(i).getRoomID()%>&nbsp;&nbsp;&nbsp;&nbsp;<%=roomTypeList.get(j).getRoomTypeName()%></div>
	            					<div style="margin-top: 15px;font-size: 20px;">空</div>
	        					</div>
	   							<%
	   							break;
	   						}
	   					}
	   				}
	   			}
   			}
   		 %>
   	</div>
</div>
<script src="javascripts/registerInHome.js"></script>
  </body>
</html>
